package backend;

import org.w3c.dom.Document;
import org.w3c.dom.NodeList;

public class Categories {
	private String categ[];
	private String url="http://eiffel.itba.edu.ar/hci/service/Catalog.groovy?method=GetCategoryList&language_id=1";

	public void initialize() {
		try{
			Connect con = new Connect();
			Document dom = con.getConection(url);
			NodeList categories = dom.getElementsByTagName("name");
			this.categ = new String[categories.getLength()];
			for(int i=0; i<categories.getLength(); i++){
				categ[i]=new String(categories.item(i).getTextContent());
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	public String[] getCategories(){
		return this.categ;
	}
	
}
